﻿using System.Collections.Generic;
using HamcoWcs.Entitys.DeviceErrors;
using HamcoWcs.Entitys.MainTasks;
using HamcoWcs.Entitys.WcsLocations;
using HamcoWcs.Models.DeviceMsgs;
using HamcoWcs.Models.Devices;
using HamcoWcs.Models.NodeInfos;
using HamcoWcs.Models.TibcoMessage;

namespace HamcoWcs.Contract.ContractMes
{
    /// <summary>
    /// 与Mes通讯服务
    /// </summary>
    public interface IMesCommunicateService
    {
        void SendBuffer();
        #region ppk

        ///// <summary>
        ///// 切换CV设备机况状态(ONLINEREMOTE)
        ///// </summary>
        ///// <param name="message"></param>
        //void MachineControlStateChanged(MachineControlStateChangedMessage message);
        void MachineControlStateChanged(NodeInfoDto machine);
        /// <summary>
        /// 切换CV设备机况状态
        /// </summary>
        void MachineStateChanged(NodeInfoDto machine);
        void MachineStateChanged(string machineName, EnumMachineState state);
        void MachineStateChanged(PconDto pcon);
        void MachineStateChanged(SrmDto srm);

        /// <summary>
        /// 切换Port的状态(INSERVICE)
        /// </summary>
        /// <param name="message"></param>
        void PortStateChanged(PortStateChangedMessage message);
        /// <summary>
        /// 状态变更时调用
        /// </summary>
        /// <param name="pcon"></param>
        /// <param name="msg"></param>
        void PortStateChanged(PconDto pcon, PconRecvMsg msg);

        /// <summary>
        /// 初始化时调用
        /// </summary>
        /// <param name="pcon"></param>
        void PortStateChanged(PconDto pcon);
        /// <summary>
        /// 切换Pallet的进出方向Request
        /// </summary>
        /// <param name="message"></param>
        void MachineModeChangeRequest(MachineModeChangeMessage message);
        void MachineModeChangeRequest(PconDto pcon, string mode);
        /// <summary>
        /// 切换Pallet的进出方向Reply
        /// </summary>
        /// <param name="message"></param>
        void MachineModeChangeReply(MachineModeChangeMessage message);
        /// <summary>
        /// 切CV投栈板类型
        /// </summary>
        /// <param name="message"></param>
        void ChangeMachinePalletTypeRequest(ChangeMachinePalletTypeMessage message);
        void ChangeMachinePalletTypeRequest(PconDto pcon, string type);

        /// <summary>
        /// 上报Pallet与Box的绑定关系Request
        /// </summary>
        /// <param name="message"></param>
        void PalletAndBoxAssignRequest(PalletAndBoxAssignMessage message);

        /// <summary>
        /// 上报验证实Pallet信息Request
        /// </summary>
        /// <param name="message"></param>
        void ValidatePalletInputRequest(ValidatePalletInputMessage message);

        /// <summary>
        /// 上报Pallet与Pallet的绑定关系Request
        /// </summary>
        /// <param name="message"></param>
        void ValidatePalletListRequest(ValidatePalletListMessage message);

        /// <summary>
        /// 上报Pallet在CV设备移动的信息
        /// </summary>
        /// <param name="message"></param>
        void PalletLocationChangedReport(PalletLocationChangedReportMessage message);
        /// <summary>
        /// When the port is changed state, the system reports this event.
        /// </summary>
        /// <param name="message"></param>
        void PortTransferStateChanged(PortTransferStateChangedMessage message);
        void PortTransferStateChanged(PconDto pcon);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="message"></param>
        void PalletRequestTransportJobRequest(PalletRequestTransportJobMessage message);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="message"></param>
        void PalletRequestTransportJobReply(PalletRequestTransportJobMessage message);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="message"></param>
        void PalletTransportJobStarted(PalletTransportJobStartedMessage message);
        void PalletTransportJobStartedByAGV(PalletTransportJobStartedByAGVMessage message);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="message"></param>
        void PalletLocationChanged(PalletLocationChangedMessage message);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="message"></param>
        void PalletTransportJobCompleted(PalletTransportJobCompletedMessage message);
        void PalletTransportJobCompleted(MainTask mainTask);

        /// <summary>
        /// 连接Mes<br/>
        /// 每十秒发送一次
        /// </summary>
        void AreYouThereRequest();
        void InventoryPalletDataRequest(InventoryPalletDataReportMessage message);
        void InventoryPalletDataReport(InventoryPalletDataReportMessage message);
        void InventoryZoneDataRequest(InventoryZoneDataReportMessage message);

        //void PalletTransportJobTerminatedByAGV(PalletTransportJobTerminatedByAGVMessage message);
        void PalletTransportJobTerminatedByAGV(MainTask mainTask,string locState = "");


        /// <summary>spec 7.4<br/>Wcs更改优先级上报</summary>
        void PalletTransportPriorityChanged(string jobName, string priority);


        void GetPalletInfoRequest(string palletName);

        void AlarmReport(AlarmReportMessageBody body);
        void AlarmReportSet(DeviceErrorQueue d);
        void AlarmReportClear(DeviceErrorQueue d);

        void MachineFrequencyRequest(string machineName, string frequency);
        // CSP050
        void SpacerCarrierChangeRequest(string machineName, string carrierName, string spacerQuantity, string settingCode);

        void PalletAlarmReport(PconDto con, string lunitId, string runitId);

        void CreateTransportJobByWCS(MainTask mainTask);

        void PalletLocStateChanged(WcsLocation loc);

        void CurrentStockerEmptyBoxPlanRequest(string machineName);

        void TransportJobListReportByWCS(List<MainTask> mainTasks);//新加任务同步

        #endregion
    }
}
